package cyx.example.ddd.domain.order.event;

import cyx.example.ddd.domain.order.model.aggregate.Order;
import cyx.example.ddd.domain.order.model.valueobject.Money;
import cyx.example.ddd.domain.shared.DomainEvent;
import lombok.Getter;

/**
 * 订单支付事件
 * 
 * 注意：这是一个示例实现，在实际企业项目中，可能需要考虑：
 * 1. 支付方式信息
 * 2. 支付时间戳
 * 3. 支付流水号
 * 4. 支付状态详情
 */
@Getter
public class OrderPaidEvent implements DomainEvent {

    private final String orderId;
    private final String userId;
    private final Money amount;
    private final String currency;

    public OrderPaidEvent(Order order) {
        this.orderId = order.getId();
        this.userId = order.getUserId();
        this.amount = order.getTotalAmount();
        this.currency = order.getCurrency().getCurrencyCode();
    }

    @Override
    public String toString() {
        return String.format("OrderPaidEvent{orderId='%s', userId='%s', amount=%s}",
                orderId, userId, amount);
    }
}